package 集合进阶.单列集合.List集合.Set集合;

import java.util.LinkedHashSet;

public class LinkedHashSet练习 {
    public static void main(String[] args) {
        //1.创建4个学生对象
        Student stu1=new Student("张三",23);
        Student stu2=new Student("李四",24);
        Student stu3=new Student("王五",25);
        Student stu4=new Student("张三",23);

        //2.创建集合对象--->可以保证数据的存储数据.
        LinkedHashSet<Student> lhs=new LinkedHashSet<>();
        lhs.add(stu3);
        lhs.add(stu2);
        lhs.add(stu1);
        lhs.add(stu4);

        //3.打印集合
        System.out.println(lhs);
    }
}
